#!/usr/bin/python3

import ftplib
import urllib
import mrget


if True:
    if True:
        ret = {}

        def __proc(line):
            ret[line.split()[-1]] = None

        urlList = mrget.target_urls("mirror://librungame-repacks", protocols=["ftp"], max_count=3)
        parsedUrl = urllib.parse.urlparse(urlList[0])
        ftp = ftplib.FTP(parsedUrl.hostname, parsedUrl.port)
        try:
            ftp.login()
            ftp.cwd(parsedUrl.path)
            ftp.retrlines('LIST', __proc)
        finally:
            ftp.quit()

        print(ret)
